<template>
	<view class="contents" :style="'height:'+screenHeight+'px'">
		<view class="herder">
			<view class="headerchildren">
				<view class="date-tabs-container">
					<view class="calendar-button color1">
						<u-icon name="calendar" size="65"></u-icon>
					</view>
					<view class="tabs-wrapper">
						<view class="span" v-for="(item,index) in list1" :key="index" @click="count(index)"  :class="{color1blod : index === countindex}">
							<span class="spans">{{item.week}}</span>
							<span class="spans">{{item.day}}</span>
						</view>
					</view>
					
				</view>
			</view>
		</view>

		<view class="content">
			<view class="none" v-if="show==false">
				<view class="coent" >
					<u-empty text="当日暂无排班" mode="data" icon="/static/zwnr.png" icon-size="200">
					</u-empty>
				</view>
			</view>
			<view class="shows" v-else>
				<view class="showlist" v-for="(doctor,index) in doctorinfor" :key="index" @click="situation(doctor.DutyId)">
					<view class="imglist">
						<view class="imgleft">
							<!-- <u--image :src="doctor.HeadImg" width="90" height="100"></u--image> -->
							<u-avatar :src="doctor.HeadImg" size='150'></u-avatar>
						</view>
						<view class="imgcount">
							<span class="name">{{doctor.DoctorName}}</span>
							<span class="describe">职称：{{doctor.WorkType}}</span>
							<span class="describe">擅长：{{doctor.WorkDuty}}</span>
						</view>
						<view class="imgright">
							<view class="excessive bacnone2" v-if="doctor.Status==1"><span>有号</span></view>
							<view class="excessive gray" v-else><span>无号</span></view>
						</view>
						
					</view>
					<!-- <u-divider></u-divider> -->
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	//import DateTabs from '@/uni_modules/hope-11-date-tabs/components/hope-11-date-tabs/date-tabs.vue'
	export default {
		data() {
			return {
				screenHeight: getApp().globalData.screenHeight-44,
				show: false,
				countindex: 0,
				doctorinfor: [],
				list: [{
					name: '待收货'
				}, {
					name: '待付款'
				}, {
					name: '待评价'
				}],
				list1: []
			}
		},
		created() {

		},
		mounted() {

		},
		onLoad: function(DepartmentId) {
			//console.log(DepartmentId)
			uni.showLoading({
				title: '加载中'
			})
			this.$request('DutyRecord', 'Dutylist', {
				dptid: DepartmentId.DepartmentId
			}).then(res => {
				if (res.code == 1) {
					console.log("ressss", res)
					this.list1 = res.data
					// let list = this.list1
					// for (let i = 0; i < list.length; i++) {
					// 	this.list1[i].name = `` + list[i].week + `\n` + list[i].day + ``
					// }
					this.content()
				} else {
					uni.hideLoading();
					console.log("获取失败")
				}
			})

		},
		computed: {

		},
		methods: {
			count(index){
				console.log("index",index)
				this.countindex=index
				let item = this.list1[index]
				if (item.ReturnDuty.length == 0) {
					this.show = false
					return
				} else {
					//console.log('item', item.doctor);
					this.show = true
				}
				this.doctorinfor = []
				this.doctorinfor = item.ReturnDuty
			},
			situation(DutyId) {
				uni.navigateTo({
					url: `/pages/register/situation/situation?DutyId=${DutyId}`,
					fail(error) {
						console.log(error)
					}
				})
			},
			content() {
				uni.hideLoading();
				console.log("123")
				if (this.list1[0].ReturnDuty.length == 0) {
					this.show = false
					return
				} else {
					this.show = true
				}
				this.doctorinfor = []
				this.doctorinfor = this.list1[0].ReturnDuty

			}
		}
	}
</script>

<style>
	@import './Scheduling.css'
</style>
